const vscode = require('vscode');

/**
 * 插件被激活时触发，所有代码总入口
 * @param {*} context 插件上下文
 */
exports.activate = function(context) {
	console.log('恭喜，您的扩展“vscode-plugin-tengyu”已被激活！');
	// 注册命令
	context.subscriptions.push(vscode.commands.registerCommand('extension.tengyu', () => {
		vscode.window.showInformationMessage('Hello World! 第一个VSCode插件程序运行成功了~');
	}));
	context.subscriptions.push(vscode.commands.registerCommand('extension.tengyu.getCurrentFilePath', (uri) => {
		console.log('1111111111', uri);
		vscode.window.showInformationMessage(`当前文件(夹)路径是：${uri ? uri.path : '空'}`);
	}));

	// 编辑器命令
	context.subscriptions.push(vscode.commands.registerTextEditorCommand('extension.testEditorCommand', (textEditor, edit) => {
		console.log('您正在执行编辑器命令！');
		console.log(textEditor, edit);
	}));
};

/**
 * 插件被释放时触发
 */
exports.deactivate = function() {
	console.log('您的扩展“vscode-plugin-tengyu”已被释放！')
};
